#include <cstdio>
#include <cstring>

int main( )
{
    int t, n, c, v, d;
    double minn, minv, p;
    char name1[ 101 ], name2[ 101 ];
    scanf("%d", &t);
    while ( t-- )
    {
        scanf("%d", &n);
        minn = 100000;
        minv = 0;
        while ( n-- )
        {
            scanf("%s%d%d", name2, &c, &v);
            if ( v < 200 )
                continue;
            d = v / 200;
            if ( d > 5 )
                d = 5;
            p = double( c ) / double( d );
            if ( minn > p || ( minn == p && minv < v ) )
            {
                minn = p;
                minv = v;
                strcpy( name1, name2 );
            }
        }
        puts( name1 );
    }
    return 0;
}
